﻿using Microsoft.AspNetCore.Mvc;

namespace HoneyCms.Core.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    public class PostController : ControllerBase
    {
        private readonly PostService _postService;
        public PostController(PostService postService) => _postService = postService;

        [HttpGet]
        public IActionResult GetAllPosts() => Ok(_postService.GetAllPosts());

        [HttpPost]
        public IActionResult AddPost([FromBody] Post post)
        {
            _postService.AddPost(post);
            return Ok();
        }
    }
}
